/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Grnmnd
 */
@Entity
@Table(name = "tipoduracion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tipoduracion.findAll", query = "SELECT t FROM Tipoduracion t"),
    @NamedQuery(name = "Tipoduracion.findById", query = "SELECT t FROM Tipoduracion t WHERE t.id = :id"),
    @NamedQuery(name = "Tipoduracion.findByNombre", query = "SELECT t FROM Tipoduracion t WHERE t.nombre = :nombre"),
    @NamedQuery(name = "Tipoduracion.findByDuracionms", query = "SELECT t FROM Tipoduracion t WHERE t.duracionms = :duracionms")})
public class Tipoduracion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @Column(name = "duracionms")
    private String duracionms;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoduracion")
    private List<Membresia> membresiaList;

    public Tipoduracion() {
    }

    public Tipoduracion(Integer id) {
        this.id = id;
    }

    public Tipoduracion(Integer id, String nombre, String duracionms) {
        this.id = id;
        this.nombre = nombre;
        this.duracionms = duracionms;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDuracionms() {
        return duracionms;
    }

    public void setDuracionms(String duracionms) {
        this.duracionms = duracionms;
    }

    @XmlTransient
    public List<Membresia> getMembresiaList() {
        return membresiaList;
    }

    public void setMembresiaList(List<Membresia> membresiaList) {
        this.membresiaList = membresiaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipoduracion)) {
            return false;
        }
        Tipoduracion other = (Tipoduracion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nombre;
    }
    
}
